home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Games: 500 MB Amiga Software
/
500 MB Amiga Software - Euber 130 - Amiga Games Disc & Mag.iso
/
userbox
/
publicdomain
/
tinymeter
/
source
/
tinymeter_main
/
miscfuncs.c
< prev
next >
Wrap
C/C++ Source or Header
|
1995-10-09
|
3KB
|
85 lines
#include <intuition/intuition.h>
#include <devices/timer.h>
#include <clib/macros.h>
extern struct Window *my_window;
SaveRectFill(struct RastPort *rp, WORD x, WORD y, WORD x_siz, WORD y_siz)
{
if((x>=0)&(y>=0)&(x_siz>0)&(y_siz>0)&(x+x_siz<=my_window->Width)&(y+y_siz<=my_window->Height))
{
RectFill(rp,x,y,x+x_siz-1,y+y_siz-1);
}
}
UBYTE long_2_string_with_thousand(ULONG num, char output[], char point)
{
char output_private[16];
char n = 0;
char n_1 = 0;
sprintf_exec(output_private,"%12ld",num);
while(output_private[n]==0x20)n++;
for(;(output_private[n]!=0)&(output_private[n]!=0x20);n++)
{
output[n_1++]=output_private[n];
if((n==2)||(n==5)||(n==8)) output[n_1++]=(char)point;
}
output[n_1]=0;
return(n_1);
}
my_strlen(char s[]) /*liefert die Laenge von s */
{
int i=0;
while (s[i]!='\0')++i;
return(i);
}
ULONG p2s(ULONG wanted_size, ULONG base, ULONG gauge_x_size)
{
return((ULONG)((gauge_x_size)-(((wanted_size>>8)*gauge_x_size)/(base>>8))));
}
void draw_a_border(ULONG b_x1, ULONG b_y1, ULONG b_x2, ULONG b_y2, int b_col1, int b_col2, struct RastPort *rp)
{
SetAPen(rp,b_col2);
RectFill(rp,b_x2,b_y1+1,b_x2,b_y2);
RectFill(rp,b_x1,b_y2,b_x2,b_y2);
SetAPen(rp,b_col1);
RectFill(rp,b_x1,b_y1,b_x1,b_y2-1);
RectFill(rp,b_x1,b_y1,b_x2-1,b_y1);
}
void CopyTiledBitMap(struct BitMap *Src,WORD SrcSizeX,WORD SrcSizeY,struct RastPort *Dst)
{
WORD PosX,
PosY;
WORD SizeX,
SizeY;
for (PosX = 0,SizeX = MIN(SrcSizeX,my_window->Width);PosX<my_window->Width;)
{
for (PosY = 0,SizeY = MIN(SrcSizeY,my_window->Height);PosY<my_window->Height;)
{
BltBitMapRastPort(Src,0,0,Dst,PosX,PosY,SizeX,SizeY,0xC0);
PosY += MIN(SizeY,my_window->Height-PosY);
SizeY = MIN(SizeY,my_window->Height-PosY);
}
PosX += MIN(SizeX,my_window->Width-PosX);
SizeX = MIN(SizeX,my_window->Width-PosX);
}
}
init_time_request(struct timerequest *my_time_request_clock, ULONG my_time_mask_clock)
{
ULONG interval;
my_time_request_clock -> tr_node.io_Command = TR_GETSYSTIME;
DoIO(my_time_request_clock);
interval=my_time_request_clock -> tr_time.tv_secs;
my_time_request_clock -> tr_node.io_Command = TR_ADDREQUEST;
my_time_request_clock -> tr_time.tv_secs = interval+1;
my_time_request_clock -> tr_time.tv_micro = 0;
SetSignal(0,my_time_mask_clock);
SendIO(my_time_request_clock);
}